package com.ctp.bean;

public class MarketBean {

	private String contrName = null;

	private double lastPrice = 0;

	private double bidPrice1 = 0;

	private int bidVolume1 = 0;

	private double askPrice1 = 0;

	private int askVolume1 = 0;

	private int volume = 0;

	private int position = 0;

	private double upperPrice = 0;

	private double lowerPrice = 0;

	private double averagePrice = 0;

	private String updateTime = null;

	public void setMarketBean(String[] params) {
		contrName = params[0].trim();
		lastPrice = Double.parseDouble(params[1]);
		bidPrice1 = Double.parseDouble(params[2]);
		bidVolume1 = Integer.parseInt(params[3]);
		askPrice1 = Double.parseDouble(params[4]);
		askVolume1 = Integer.parseInt(params[5]);
		volume = Integer.parseInt(params[6]);
		position = Integer.parseInt(params[7]);
		upperPrice = Double.parseDouble(params[8]);
		lowerPrice = Double.parseDouble(params[9]);
		averagePrice = Double.parseDouble(params[10]);
		updateTime = params[11].trim();

		lastPrice = Double.isInfinite(lastPrice) ? 0 : lastPrice;
		bidPrice1 = Double.isInfinite(bidPrice1) ? 0 : bidPrice1;
		askPrice1 = Double.isInfinite(askPrice1) ? 0 : askPrice1;

		upperPrice = Double.isInfinite(upperPrice) ? 0 : upperPrice;
		lowerPrice = Double.isInfinite(lowerPrice) ? 0 : lowerPrice;
		averagePrice = Double.isInfinite(averagePrice) ? 0 : averagePrice;
	}

	public void setKeyPrice(double lastPrice, double bidPrice1, double askPrice1) {
		this.lastPrice = lastPrice;
		this.bidPrice1 = bidPrice1;
		this.askPrice1 = askPrice1;
	}

	public String getContrName() {
		return contrName;
	}

	public double getLastPrice() {
		return lastPrice;
	}

	public double getBidPrice1() {
		return bidPrice1;
	}

	public int getBidVolume1() {
		return bidVolume1;
	}

	public double getAskPrice1() {
		return askPrice1;
	}

	public int getAskVolume1() {
		return askVolume1;
	}

	public int getVolume() {
		return volume;
	}

	public int getPosition() {
		return position;
	}

	public double getUpperPrice() {
		return upperPrice;
	}

	public double getLowerPrice() {
		return lowerPrice;
	}

	public double getAveragePrice() {
		return averagePrice;
	}

	public String getUpdateTime() {
		return updateTime;
	}

}
